<!doctype html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../assert_selection.js"></script>
<script>
selection_test(
    [
        '<div contenteditable>',
            '<table><tbody>',
                '<tr><td>one</td></tr>',
                '<tr><td>two</td></tr>',
                '<tr><td>three</td></tr>',
            '</tbody></table>|',
        '</div>',
    ],
    'insertText X',
    [
        '<div contenteditable>',
            '<table><tbody>',
                '<tr><td>one</td></tr>',
                '<tr><td>two</td></tr>',
                '<tr><td>three</td></tr>',
            '</tbody></table>X|',
        '</div>',
    ],
    'Typing after end of last list item');
selection_test(
    [
        '<div contenteditable>',
            '|<table><tbody>',
                '<tr><td>one</td></tr>',
                '<tr><td>two</td></tr>',
                '<tr><td>three</td></tr>',
            '</tbody></table>',
        '</div>',
    ],
    'insertText X',
    [
        '<div contenteditable>',
            'X|<table><tbody>',
                '<tr><td>one</td></tr>',
                '<tr><td>two</td></tr>',
                '<tr><td>three</td></tr>',
            '</tbody></table>',
        '</div>',
    ],
    'Typing before <table>');
</script>
